import React from 'react';
import { Router, Route, IndexRedirect } from 'react-router';
// 登入页
import LOGIN_PAGE from 'Page/LoginPage';
// 食安展示

import SHIANSYS_PAGE from 'Page/VisualPage';
import TRACK_PAGE from 'Page/VisualPage/TrackPage';

import DISPATCH_DISPATCH from 'Page/DispatchPage/DispatchSystem';
import DISPATCH_TASK from 'Page/DispatchPage/DispatchSystem/Task';
import BIG_DATA_MAP from 'Page/BigDataPage/Map';
import BIG_DATA_PROFESSION from 'Page/BigDataPage/Profession';
import DATA_ANALYZE_PAGE from 'Page/BigDataPage/AnalyzePage';
import INSPECTION_RECORDS from 'Page/BigDataPage/Map/InspectionRecordsPage';
import PATROL_RECORD from 'Page/BigDataPage/Map/InspectionRecordsPage/PatrolRecordPage';
import CHECK_RECORD from 'Page/BigDataPage/Map/InspectionRecordsPage/CheckRecordPage';
import PUNISHMENT_RECORD from 'Page/BigDataPage/Map/InspectionRecordsPage/PunishmentRecordPage';
import REGULATORY_AGENCY_PAGE from 'Page/BigDataPage/Map/RegulatoryAgencyPage';

import CO_RULE_EXHIBITION from 'Page/CoRulePage/Exhibition';
import VIDEO_PROPAGANDA from 'Page/CoRulePage/Exhibition/VideoPropaganda';
import VIDEO_ADD from 'Page/CoRulePage/Exhibition/VideoPropaganda/AddPage';
import VIDEO_DETAIL from 'Page/CoRulePage/Exhibition/VideoPropaganda/DetailPage';
import VR from 'Page/CoRulePage/Exhibition/VR';
import VR_ADD from 'Page/CoRulePage/Exhibition/VR/AddPage';
import VR_DETAIL from 'Page/CoRulePage/Exhibition/VR/DetailPage';
import DAILY from 'Page/CoRulePage/Exhibition/Daily';
import DAILY_ADD from 'Page/CoRulePage/Exhibition/Daily/AddPage';
import DAILY_DETAIL from 'Page/CoRulePage/Exhibition/Daily/DetailPage';

import CO_RULE_SERVER from 'Page/CoRulePage/Server';
import SORT from 'Page/CoRulePage/Server/Sort';
import INTRODUCTION from 'Page/CoRulePage/Server/Introduction';
import CO_RULE_SERVER_ADD from 'Page/CoRulePage/Server/Introduction/AddPage';
import CO_RULE_SERVER_DETAIL from 'Page/CoRulePage/Server/Introduction/DetailPage';

import CO_RULE_INTERACTIVE from 'Page/CoRulePage/Interactive';
import COMPLAINTS_REPORT from 'Page/CoRulePage/Interactive/ComplaintsReport';
import COMPLAINTS_DETAIL from 'Page/CoRulePage/Interactive/ComplaintsReport/DetailPage';
import SUPERVISE from 'Page/CoRulePage/Interactive/Supervise';
import DIALOGUE_RECEPTION from 'Page/CoRulePage/Interactive/DialogueReception';
import DIALOGUE_DETAIL from 'Page/CoRulePage/Interactive/DialogueReception/DetailPage';
import FOOD_SAFETY from 'Page/CoRulePage/Interactive/FoodSafety';
import KNOWLEDGE_EVALUATION from 'Page/CoRulePage/Interactive/KnowledgeEvaluation';
import ADVICE_DETAIL from 'Page/CoRulePage/Interactive/FoodSafety/AdviceDetai';
// 知识测评
import TEST_RESULT from 'Page/CoRulePage/Interactive/KnowledgeEvaluation/KnowledgeResult';
import QUESTION_MNG from 'Page/CoRulePage/Interactive/KnowledgeEvaluation/QuestionBank';
import QUESTION_DETAIL from 'Page/CoRulePage/Interactive/KnowledgeEvaluation/QuestionDetail';
import QUESTION_MANAGE from 'Page/CoRulePage/Interactive/KnowledgeEvaluation/QuestionMng';
import SIG_QUESTION_DETAIL from 'Page/CoRulePage/Interactive/KnowledgeEvaluation/QuestionMng/Component/SigQuestionDetail';
import ADD_NEW_QUESTION from 'Page/CoRulePage/Interactive/KnowledgeEvaluation/QuestionMng/AddNewQuestion';
import MODIFY_QUESTION from 'Page/CoRulePage/Interactive/KnowledgeEvaluation/QuestionMng/ModifyQuestion';

import MANAGER_ROLE from 'Page/ManagerPage/Role';
import MANAGER_ACCOUNT from 'Page/ManagerPage/Account';
import MANAGER_SYSTEM from 'Page/ManagerPage/System';
import VIDEO_PAGE from 'Page/VideoSysPage';
// 决策支持
import DISPATCH_SUPPORT from 'Page/DispatchPage/DispatchSupport';
import EMERGENCY_HANDING from 'Page/DispatchPage/DispatchSupport/EmergencyHanding';
import IMPORTANT_SUPERVISE from 'Page/DispatchPage/DispatchSupport/ImportantSurpervise';
import IMPORTANT_SUPERVISE_DETAIL from 'Page/DispatchPage/DispatchSupport/ImportantSurpervise/Detail';
import TYPICAL_CASE from 'Page/DispatchPage/DispatchSupport/TypicalCase';
import TYPICAL_CASE_ADD from 'Page/DispatchPage/DispatchSupport/TypicalCase/Add';
import TYPICAL_CASE_ADD_NEXT from 'Page/DispatchPage/DispatchSupport/TypicalCase/Add/Next';
import TYPICAL_CASE_DETAIL from 'Page/DispatchPage/DispatchSupport/TypicalCase/Detail';
import TYPICAL_CASE_EDIT from 'Page/DispatchPage/DispatchSupport/TypicalCase/Edit';
import SPECIAL_MANAGE from 'Page/DispatchPage/DispatchSupport/SpecialManage';
import SPECIAL_MANAGE_LIST from 'Page/DispatchPage/DispatchSupport/SpecialManage/List';
import SPECIAL_MANAGE_DETAIL from 'Page/DispatchPage/DispatchSupport/SpecialManage/Detail';
import CUSTOM_PLAN from 'Page/DispatchPage/DispatchSupport/CustomPlan';
import CUSTOM_PLAN_DETAIL from 'Page/DispatchPage/DispatchSupport/CustomPlan/Detail';
import CREATE_PLAN_PAGE from 'Page/DispatchPage/DispatchSupport/ImportantSurpervise/CreatePlan';
import CREATE_NEW_PLAN_PAGE from 'Page/DispatchPage/DispatchSupport/SpecialManage/CreateNewPlan';
import CHOOSE_MAP from 'Page/DispatchPage/DispatchSupport/SpecialManage/ChooseMap';
import DISPATCH_VIDEO from 'Page/DispatchPage/DispatchSystem/videoSys';

import TEST_PAGE from 'Page/TestPage';
//预警体系
import ALERT_MAIN_PAGE from 'Page/AlertPage/MainPage';
import ALERT_SUPERVISE_PAGE from 'Page/AlertPage/SupervisePage';
import ONE_KEY_PATROL from 'Page/AlertPage/OneKeyPatrol';
//预警规则
import ALERT_RULE_TAB from 'Page/AlertRulePage/RuleTab';
import ALERT_RULE_PAGE from 'Page/AlertRulePage';
import ORGINAZE_RULE_PAGE from 'Page/AlertRulePage/OrganizeRule';

// 数据导入
import MOBILE_LAW_PAGE from 'Page/DataImportPage';
import PUNISH_DATA from 'Page/DataImportPage/MobileLaw/PunishData';
import DAY_RECORD from 'Page/DataImportPage/MobileLaw/DayRecord';
import WORK_SHOP from 'Page/DataImportPage/WorkShop';
import INPECT_PAGE from 'Page/DataImportPage/Inspect';
import YONG_AN_TONG from 'Page/DataImportPage/YongAnTong';

//食安地图
import SHIAN_MAP from 'Page/CoRulePage/ShiAnMap';

import PAGE_CONTAINER from '../containers/PageContainer';
import SYSTEM_CONTAINER from '../containers/SystemContainer';
import { validate, checkPermission, checkRedirectPermission } from './enterHandles';
import { history } from '../store/configureStore';


class DevRoute extends React.PureComponent {
  render() {
    return (
      <Router history={history}>
        <Route path="/" onEnter={validate} component={PAGE_CONTAINER}>
          <IndexRedirect to="/system/visual/shian" />
          {/* 登入页 */}
          <Route path="/login" component={LOGIN_PAGE} />

          {/* 各套管理系统 */}
          <Route path="/system" onEnter={checkRedirectPermission} component={SYSTEM_CONTAINER}>
            {/* 可视化展示管理 */}
            <Route path="/system/visual/video(/:type/:id)" component={VIDEO_PAGE} />
            <Route path="/system/visual/shian" component={SHIANSYS_PAGE} />
            <Route path="/system/visual/track_page" component={TRACK_PAGE} />

            {/* 指挥调度系统 */}
            <Route path="/system/dispatch/dispatch" onEnter={checkPermission} component={DISPATCH_DISPATCH} />
            <Route path="/system/dispatch/dispatch/task/:id" onEnter={checkPermission} component={DISPATCH_TASK} />
            <Route path="/system/dispatch/dispatch/video/:type/:id" onEnter={checkPermission} component={DISPATCH_VIDEO} />

            {/*决策支持*/}
            <Route path="/system/dispatch/support" onEnter={checkPermission} component={DISPATCH_SUPPORT}>
              <IndexRedirect to="/system/dispatch/support/emergency_handing" />
              <Route path="/system/dispatch/support/emergency_handing" component={EMERGENCY_HANDING} />
              <Route path="/system/dispatch/support/important_supervise" component={IMPORTANT_SUPERVISE} />
              <Route path="/system/dispatch/support/important_supervise/detail/:id" component={IMPORTANT_SUPERVISE_DETAIL} />
              <Route path="/system/dispatch/support/typical_case" component={TYPICAL_CASE} />
              <Route path="/system/dispatch/support/typical_case/add" component={TYPICAL_CASE_ADD} />
              <Route path="/system/dispatch/support/typical_case/add_next/:id" component={TYPICAL_CASE_ADD_NEXT} />
              <Route path="/system/dispatch/support/typical_case/detail/:id" component={TYPICAL_CASE_DETAIL} />
              <Route path="/system/dispatch/support/typical_case/edit/:id" component={TYPICAL_CASE_EDIT} />
              <Route path="/system/dispatch/support/special_manage" component={SPECIAL_MANAGE} />
              <Route path="/system/dispatch/support/special_manage/list" component={SPECIAL_MANAGE_LIST} />
              <Route path="/system/dispatch/support/special_manage/detail/:id" component={SPECIAL_MANAGE_DETAIL} />
              <Route path="/system/dispatch/support/special_manage/create_new_plan(/:id)" component={CREATE_NEW_PLAN_PAGE} />
              <Route path="/system/dispatch/support/special_manage/choose_map" component={CHOOSE_MAP} />
              <Route path="/system/dispatch/support/custom_plan" component={CUSTOM_PLAN} />
              <Route path="/system/dispatch/support/custom_plan/detail/:id" component={CUSTOM_PLAN_DETAIL} />
              <Route path="/system/dispatch/support/custom_plan/create_plan(/:id)" component={CREATE_PLAN_PAGE} />
            </Route>

            {/* 大数据分析系统 */}
            <Route path="/system/bigdata/analyze" component={DATA_ANALYZE_PAGE} />
            <Route path="/system/bigdata/map" component={BIG_DATA_MAP} />
            <Route path="/system/bigdata/profession" component={BIG_DATA_PROFESSION} />
            <Route path="/system/bigdata/map/records/:id" component={INSPECTION_RECORDS}>
              <IndexRedirect to="/system/bigdata/map/records/patrol_record/:id" />
              <Route path="/system/bigdata/map/records/patrol_record/:id" component={PATROL_RECORD} />
              <Route path="/system/bigdata/map/records/check_record/:id" component={CHECK_RECORD} />
              <Route path="/system/bigdata/map/records/punishment_record/:id" component={PUNISHMENT_RECORD} />
            </Route>
            <Route path="/system/bigdata/map/records/reculatory_agency/:id" component={REGULATORY_AGENCY_PAGE} />
            <Route path="/system/bigdata/analyze" onEnter={checkPermission} component={DATA_ANALYZE_PAGE} />
            <Route path="/system/bigdata/map" onEnter={checkPermission} component={BIG_DATA_MAP} />
            <Route path="/system/bigdata/profession" onEnter={checkPermission} component={BIG_DATA_PROFESSION} />

            {/* 预警体系系统 */}
            <Route path="/system/alert/main" onEnter={checkPermission} component={ALERT_MAIN_PAGE} />
            <Route path="/system/alert/supervise" onEnter={checkPermission} component={ALERT_SUPERVISE_PAGE} />
            <Route path="/system/alert/supervise/one_key" onEnter={checkPermission} component={ONE_KEY_PATROL} />

            {/* 预警规则 */}
            <Route path="/system/alert/alert_rule" onEnter={checkPermission} component={ALERT_RULE_TAB}>
              <IndexRedirect to="/system/alert/alert_rule/business_rule" />
              <Route path="/system/alert/alert_rule/business_rule" component={ALERT_RULE_PAGE} />
              <Route path="/system/alert/alert_rule/organize_rule" component={ORGINAZE_RULE_PAGE} />
            </Route>

            {/* 社会共治 */}
            <Route path="/system/corule/exhibition" onEnter={checkPermission} component={CO_RULE_EXHIBITION}>
              <IndexRedirect to="/system/corule/exhibition/daily" />
              <Route path="/system/corule/exhibition/video" component={VIDEO_PROPAGANDA} />
              <Route path="/system/corule/exhibition/video/add(/:id)" component={VIDEO_ADD} />
              <Route path="/system/corule/exhibition/video/detail/:id" component={VIDEO_DETAIL} />
              <Route path="/system/corule/exhibition/vr" component={VR} />
              <Route path="/system/corule/exhibition/vr/add(/:id)" component={VR_ADD} />
              <Route path="/system/corule/exhibition/vr/detail/:id" component={VR_DETAIL} />
              <Route path="/system/corule/exhibition/daily" component={DAILY} />
              <Route path="/system/corule/exhibition/daily/add(/:id)" component={DAILY_ADD} />
              <Route path="/system/corule/exhibition/daily/detail/:id" component={DAILY_DETAIL} />
            </Route>
            <Route path="/system/corule/server" onEnter={checkPermission} component={CO_RULE_SERVER}>
              <IndexRedirect to="/system/corule/server/sort" />
              <Route path="/system/corule/server/sort" component={SORT} />
              <Route path="/system/corule/server/introduction" component={INTRODUCTION} />
            </Route>
            <Route path="/system/corule/server/add(/:id)" onEnter={checkPermission} component={CO_RULE_SERVER_ADD} />
            <Route path="/system/corule/server/detail/:id" onEnter={checkPermission} component={CO_RULE_SERVER_DETAIL} />
            <Route path="/system/corule/interactive" onEnter={checkPermission} component={CO_RULE_INTERACTIVE}>
              <IndexRedirect to="/system/corule/interactive/complaints" />
              <Route path="/system/corule/interactive/complaints" component={COMPLAINTS_REPORT} />
              <Route path="/system/corule/interactive/complaints/detail/:id" component={COMPLAINTS_DETAIL} />
              <Route path="/system/corule/interactive/supervise" onEnter={checkPermission} component={SUPERVISE} />
              <Route path="/system/corule/interactive/dialogue" component={DIALOGUE_RECEPTION} />
              <Route path="/system/corule/interactive/dialogue/detail/:id" component={DIALOGUE_DETAIL} />
              <Route path="/system/corule/interactive/food_safety" component={FOOD_SAFETY} />
              <Route path="/system/corule/interactive/food_safety/advice_detail/:id" component={ADVICE_DETAIL} />
              {/* 知识测评 */}
              <Route path="/system/corule/interactive/knowledge" onEnter={checkPermission} component={KNOWLEDGE_EVALUATION} >
                <IndexRedirect to="/system/corule/interactive/knowledge/test_result" />
                <Route path="/system/corule/interactive/knowledge/test_result" component={TEST_RESULT} />
                <Route path="/system/corule/interactive/knowledge/question_mng" component={QUESTION_MNG} />
              </Route>
              <Route path="/system/corule/interactive/knowledge/question_detail/:id" component={QUESTION_DETAIL} />
              <Route path="/system/corule/interactive/knowledge/question_type_mng/:id" component={QUESTION_MANAGE} />
              <Route path="/system/corule/interactive/knowledge/sig_question_detail/:id" component={SIG_QUESTION_DETAIL} />
              <Route path="/system/corule/interactive/knowledge/add_new_question/:id" component={ADD_NEW_QUESTION} />
              <Route path="/system/corule/interactive/knowledge/modify_question/:id" component={MODIFY_QUESTION} />
            </Route>
            <Route path="/system/corule/shian_map" onEnter={checkPermission} component={SHIAN_MAP} />


            {/* 系统管理 */}
            <Route path="/system/manager/role" onEnter={checkPermission} component={MANAGER_ROLE} />
            <Route path="/system/manager/account" onEnter={checkPermission} component={MANAGER_ACCOUNT} />
            <Route path="/system/manager/system" onEnter={checkPermission} component={MANAGER_SYSTEM} />

            {/* 数据导入 */}
            <Route path="/system/data/mobile_law" onEnter={checkPermission} component={MOBILE_LAW_PAGE}>
              <IndexRedirect to="/system/data/mobile_law/punish_data" />
              <Route path="/system/data/mobile_law/punish_data" component={PUNISH_DATA} />
              <Route path="/system/data/mobile_law/day_record" component={DAY_RECORD} />
            </Route>
            <Route path="/system/data/work_shop" onEnter={checkPermission} component={WORK_SHOP} />
            <Route path="/system/data/inspect" onEnter={checkPermission} component={INPECT_PAGE} />
            <Route path="/system/data/yong_an_tong" onEnter={checkPermission} component={YONG_AN_TONG} />

            {/* 测试页面 */}
            <Route path="/system/test" component={TEST_PAGE} />
          </Route>
        </Route>
      </Router>
    );
  }
}

export default DevRoute;
